// pages/device/recordList.ts
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    emptyImg: app.getImgUrl('empty.svg'),
    defaultAvatar: app.getImgUrl('nohead.png'),
    scrollHeight: 0,
    recordList: [],
    processSteps: ['已出发', '开始处理', '维修报价', '已完结'],
    statusDict: { '0': '待接收', '1': '执行中', '2': '已完成', '3': '已取消', '-1': '已删除' }
  },
  onLoad(option) {
    this.setData({
      deviceID: option.id
    })
    this.getRecordList()
  },
  getRecordList() {
    app.axios('item', {
      op: 'ajaxDevwoos',
      // zdid: this.data.deviceID
      zqdids: '160,159,158,157,34,188'
    }).then(res => {
      if (res.code) {
        res.lists.forEach(item => {
          item.statusText = this.data.statusDict[item.status]
          item.dateTime = app.dateFormatter(item.ftime)
          let galleryList = []
          item.imgs.forEach(item1 => {
            let img = app.globalData.attachBaseUrl + item1
            galleryList.push(img)
          })
          item.galleryList = galleryList
        })
        this.setData({
          recordList: res.lists
        })
      }
    })
    // app.axios('workOrder', { op: 'ajaxWorkOrderList', page: 2 }).then(res => { })
  },
  viewExecuteLogPage() {
    wx.navigateTo({
      url: '/pages/client/execute_log',
    })
  }
})